<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a="http://richfaces.org/a4j"
    template="layout/template.xhtml">

    <ui:define name="body">
		<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"/>
		<script type="text/javascript" src="#{request.contextPath}/common/js/lastTravelsMap.js"/>
		
        <h1>Welcome to ACAB!</h1>
        <rich:panel>
            <h:panelGrid columns="3" style="width:100%">
                
                <s:div styleClass="last_travels_map"> 
                
	                <rich:tabPanel width="350px" height="320px">
	                	<rich:tab label="Last travels" >

			                <script type="text/javascript">
			                function  setPoints(){    
			                <ui:repeat var="_travel" value="#{homeBean.getLastTravels(false)}">
			                		setTravel('#{_travel.fromLat}', '#{_travel.fromLon}','#{_travel.user.login}');		
			                </ui:repeat>
			                }
			                </script>
			                
			                <rich:gmap 		enableDragging="true" 
											gmapVar="map" 
											zoom="2"
											mapType="G_NORMAL_MAP" 
											lat="43"
											lng="2" 
											style="width: 305px; height: 300px;"
											oninit="initMap(map); setPoints();">
							</rich:gmap>
						</rich:tab>  
						<rich:tab label="Travels within 48h">

			                <script type="text/javascript">
			                function  setPoints(){    
			                <ui:repeat var="_travel" value="#{homeBean.getTravelsSoon(false)}">
			                		setTravel('#{_travel.fromLat}', '#{_travel.fromLon}','#{_travel.user.login}');		
			                </ui:repeat>
			                }
			                </script>
			                
			                <rich:gmap 		enableDragging="true" 
											gmapVar="map" 
											zoom="2"
											mapType="G_NORMAL_MAP" 
											lat="43"
											lng="2" 
											style="width: 305px; height: 300px;"
											oninit="initMap(map); setPoints();">
							</rich:gmap>

						</rich:tab>  
						<rich:tab label="Last requests">
						</rich:tab>  
					</rich:tabPanel>
                </s:div>
                
                
                
                <s:div styleClass="info">
                    <p><strong>Welcome to ACAB! A travel coordination social network.</strong> </p>
                    <ul class="bullets">
                        <li>Share your travels.</li>
                        <li>Ask for travels.</li>
                        <li>Look for travels shared by others.</li>
                        <li>Share your traveling needs.</li>
                        <li>ACAB makes matches with peoples travels and requests.</li>
                        <li>ACAB makes suggestions grouping requests.</li>	
                        <li>...</li>
                        <li>Save money...</li>
                        <li>make friends...</li>
                        <li>And go green!</li>
                    </ul>
                </s:div>
                <s:div styleClass="acab_eventInfo">
                    <rich:dataList var="_event" value="#{acabEvents.lastEvents}" rows="20">
                    	<s:div styleClass="event_left">
                    		
                    		<s:div styleClass="event_img">
                    			<h:graphicImage value="/img/icons/no_avatar.jpg" rendered="#{_event.avatar == null}" height="30"/>
	            				<s:graphicImage value="#{_event.avatar.image}" rendered="#{_event.avatar != null}" fileName="#{_event.avatar.idAvatar}"  height="30"/>
	            			</s:div>
	        
	            			
            			</s:div>
						<s:div styleClass="event_action">       				
            				<h:outputText value="#{_event.what}" />
            			</s:div>
        			</rich:dataList>
                </s:div>
            </h:panelGrid>
        </rich:panel>

    </ui:define>
</ui:composition>
